package gold.digger;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC1529 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int minFlips(String target) {
            int count = 0;
            boolean normalFlag = true;
            for (int i = 0; i < target.length(); i++) {
                if ((normalFlag && target.charAt(i) == '0') || (!normalFlag && target.charAt(i) == '1')) continue;
                else {
                    normalFlag = !normalFlag;
                    ++count;
                }
            }

            return count;
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.minFlips("001011101"));
    }

    public static void main(String[] args) throws Exception {
        LC1529 an = new LC1529();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
